﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Web;

namespace WebFile.Models
{
    /// <summary>
    /// 返回消息
    /// </summary>
    /// 创建时间：2023-9-1 10:12:24，
    public class Result
    {
        /// <summary>
        /// 200成功，500出错
        /// </summary>
        [JsonPropertyName("Code")]
        public int Code { get; set; }

        /// <summary>
        /// 消息
        /// </summary>
        [JsonPropertyName("Msg")]
        public string Msg { get; set; }

        /// <summary>
        /// 数据
        /// </summary>
        [JsonPropertyName("Data")]
        public object Data { get; set; }

        public Result() { }

        /// <summary>
        /// 成功了
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="successed"></param>
        public Result(string msg, int successed = 1, object data = null)
        {
            Code = 200;
            Msg = msg;
            Data = data;
        }

        /// <summary>
        /// 失败消息
        /// </summary>
        /// <param name="msg"></param>
        public Result(string msg)
        {
            Code = 500;
            Msg = msg;
        }

    }
}